<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head> 
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> 
    <title>{$title} - <tp:sitename /></title>
    <meta name="keywords" content="{$keywords}" />
    <meta name="description" content="{$description}" />
    <link rel="shortcut icon" href="__PUBLIC__/images/favicon.ico" type="image/x-icon" /> 
    <link rel="stylesheet" href="__PUBLIC__/css/style_version1.css" type="text/css" />
    <link href="__PUBLIC__/css/member.css" rel="stylesheet" type="text/css" />
    <script src="__PUBLIC__/js/jquery.js" type="text/javascript"></script>
</head> 
<body> 

<include file="Public:header" />

<div class="container clearfix">
    
    <include file="Member:left" />
    
    <div class="member_main">
        <div class="perInfo">
            <div class="titleInfoBorder">
                <span>在线充值</span>
                <a class="want" href="{:U('Member/order')}">充值记录</a>
            </div>

        </div>

        <div class="tishi">
            <p class="tishi_text">
                <span class="tishi_span">注意事项</span>
            </p>
            <p class="tishi_text">
                XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
            </p>
        </div>
        <form action="{:U('Pay/pay')}" method="post" id="form_pay">
            <div class="setting-right-wrap wrap-boxes settings" style="min-height:0">
                <p class="red"><strong style="font-size:20px">积分充值</strong><span style="color:#666;margin-left:10px">(1元 = <b>{:C('POINTS')}</b> 积分)</span></p>
                <div class="setting-wrap setting-profile">
                    <div class="wlfg-wrap">
                        <label class="label">充值金额</label>
                        <input type="text" name="money" id="money" value="200" style="width:150px" onkeyup="checkMoney()"  class="form_input" autocomplete="off"/> 元
                        <span style="color:red;margin:0 0 0 5px" id="points"></span> <span class="unit_name">积分</span>
                    </div>
                </div>
                <div class="setting-wrap setting-profile">
                    <div class="message_item" style="margin-left:65px;">
                        <em class="type">支付方式：</em>
                        <label>
                            <input type="radio" class="message_rd" value="1" name="rd1" checked="checked" />
                            <span class="message_lab"><img src="__PUBLIC__/images/alipay.png" width="30px" height="30px"></span>
                        </label>
                        <!--<label>
                            <input type="radio" class="message_rd" value="0" name="rd1"  />
                            <span class="message_lab"><img src="__PUBLIC__/images/wechat.png" width="30px" height="30px"></span>
                        </label>-->
                    </div>
                    <input type="hidden" id="paytype1" name="paytype" value="alipay" /> 
                    <div class="wlfg-wrap" style="margin-top:30px">
                        <label class="label"></label>
                        <button class="btn" style="height: 36px;line-height: 36px;font-size:16px;width:140px" type="button" onclick="subPayForm()" id='btn_submit'>充值积分</button>
                    </div>
                </div>
            </div>
        </form>
        <!--<form action="{:U('Pay/pay_month')}" method="post" id="form_pay2">
            <div class="setting-right-wrap wrap-boxes settings">

                <p class="red"><strong style="font-size:20px">开通vip</strong><span style="color:#666;margin-left:10px">(免积分下载)</span></p>
                <div class="setting-wrap setting-profile">
                    <div class="wlfg-wrap">

                        <div class="recharge">
                            <foreach name="pay_month" item="row">
                                <label style="width:150px;display: inline-block"><input checked="checked" name="month" value="{$row.id}" autocomplete="off"  type="radio"> {$row.money}元<b>/</b>{$row.name}</label>
                            </foreach>
                        </div>
                    </div>
                </div>
                <div class="setting-wrap setting-profile">
                    <div class="message_item" style="margin-left:65px;">
                        <em class="type">支付方式：</em>
                        <label>
                            <input type="radio" class="message_rd" value="1" name="rd2" checked="checked" />
                            <span class="message_lab" for="rd1"><img src="__PUBLIC__/images/alipay.png" width="30px" height="30px"></span>
                        </label>
                        <label>
                            <input type="radio" class="message_rd" value="0" name="rd2"  />
                            <span class="message_lab" for="rd2"><img src="__PUBLIC__/images/wechat.png" width="30px" height="30px"></span>
                        </label>
                    </div>
                          <input type="hidden" id="paytype2" name="paytype" value="alipay" /> 
                    <div class="wlfg-wrap" style="margin-top:30px">
                        <label class="label"></label>
                        <button class="btn" style="height: 36px;line-height: 36px;font-size:16px;width:140px" type="button" onclick="subPayForm2()" id='btn_submit'>充值会员</button>
                    </div>
                </div>
            </div>
        </form>-->
    </div>
    
</div>

<include file="Public:footext" />
<include file="Member:mfooter" />
<script>
    var bei = parseInt("{:C('POINTS')}");

    function checkMoney() {
        //var money = getPoints(parseInt($("#money").val()));
		var money = parseInt($("#money").val());
        $("#points").text(money * bei);
    }
    function subPayForm() {
        var money = $("#money").val();
        if (money >= 1) {
            var rd = $('input[name=rd1]:checked').val();
            if (rd == 1) {
                $("#form_pay").submit();
            } else {
                $("#form_pay").attr("action", "{:U('Pay/wxpay')}");
            }
            $("#form_pay").submit();
        } else {
            alert("最低充值金额1元！");
            return false;
        }
    }

    $(function() {
        var money = checkMoney();
        $("#points").text(money);
    })
    function getPoints(money) {
        if (money >= 200) {
            money = money * 2;
        }
        return money;
    }
    function getMoney(money) {

        if (money >= 100 && money < 200) {
            money = money + 10;
        } else if (money >= 200) {
            money = money + 30;
        }
        return money;
    }
    function subPayForm2() {

        var rd = $('input[name=rd2]:checked').val();
        if (rd == 1) {
            $("#form_pay2").submit();
        } else {
            $("#form_pay2").attr("action", "{:U('Pay/wxpay_month')}");
        }
        $("#form_pay2").submit();
    }
</script>
</body>
</html>
